package com.catmiw.wyz;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileWriter;
import java.io.IOException;

import org.apache.poi.hwpf.extractor.WordExtractor;

public class WordTest {
	public static void getWordContent(String fileName) { 
		   FileInputStream in=null;
		try {
			in = new FileInputStream(new File(fileName));
			   WordExtractor extractor = new WordExtractor(in); 
			   String text = extractor.getText(); 
			   String[] text2 = extractor.getParagraphText();
			   for (String t:text2){
				   System.out.println("!!"+t);
			   }

			   FileWriter f = new FileWriter(new File("e:\\Test.txt")); 
			   f.write(text); 
			   f.close(); 
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} 
		} 

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		getWordContent("e:\\123.doc");
	}

}
